

library(tidyverse)
library(haven)
library(extrafont)
library(fontcm)
library(latticeExtra)
library(locfit)
library(haven)
library(fontcm)


df<-read_dta("build/fsdata.dta")

dev.off()

pdf("Figure_5_ny.pdf")
par(mar = c(5,5,5,5))
with(df, hist(df$stringency,axes = FALSE, breaks=60, ylab="", xlab="", bty="n", col="#1B9E77",border = "grey", main=NULL))
axis(side = 2, col="white", col.ticks="black")
mtext("Density", side=2, line=2, family="CM Sans", cex=1.25)
axis(1, at = c(-0.09,-0.06, -0.03, 0.0, 0.03, 0.06, 0.09),col="white", col.ticks="black")

par(new = T)
with(df, plot(locfit(df$evictionorder~df$stringency, kern="epa", deg=1), band="local", col="#D95F02", ylab="", xlab="", lwd=2, bty="n",axes="FALSE",family="CM Sans"))
axis(side = 4, col="white", col.ticks="black")
mtext("Pr(Eviction Order)", side=4, line=2.3, family="CM Sans", cex=1.25)
mtext("Stringency", side=1, line=2.75, family="CM Sans", cex=1.25)
dev.off()

embed_fonts("Figure_5_ny.pdf", outfile="Figure_5_ny.pdf")


